home *** CD-ROM | disk | FTP | other *** search
/ The Best of MacTutor - S…e Code for Volumes 1 to 5 / The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin / Source Code / #27 (Dec 87) / scheme example / code--to-run
Text File  |  1987-09-18  |  731b  |  24 lines

  1. (begin-tasking)
  2.  
  3. (define (unequal1 x . lists)
  4.   (cond ((null? lists) #f)
  5.         ((equal? x (car lists))
  6.          (apply unequal1 (cons x (cdr lists))))
  7.         (else (car lists))))
  8.  
  9. (define (unequal2 x . objects)
  10.   (let* ((ans #f)
  11.          (task-count (length objects))
  12.          (tasks (map (lambda (y)
  13.                        (start-task
  14.                         (lambda ()
  15.                           (if (not (equal? x y))
  16.                               (begin (set! ans y)
  17.                                      (set! task-count 0)))
  18.                           (set! task-count (- task-count 1)))))
  19.                      objects)))
  20.     (while (> task-count 0)
  21.            (surrender-timeslice))
  22.     (for-each kill-task tasks)
  23.     ans))
  24.